package com.example.mes_sys.vo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.List;

@Data
public class UserDetailsVo implements UserDetails {
    private Long id;
    private String userName;//用户名
    @JsonIgnore
    private String password;//密码
    private Boolean enabled;//是否有效
    private Boolean notExpired;//是否过期
    private Boolean accountNotLocked;//账号是否锁定
    private Boolean credentialsNotExpired;//证书是否过期

    private String token;//token
    private List<GrantedAuthority> authorities;//权限


    @Override
    public String getUsername() {
        return userName;
    }

    @Override
    public boolean isAccountNonExpired() {
        return this.notExpired;
    }

    @Override
    public boolean isAccountNonLocked() {
        return this.accountNotLocked;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return this.credentialsNotExpired;
    }

    @Override
    public boolean isEnabled() {
        return this.enabled;
    }
}
